package cn.com.sueframe.demo.vo;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
/**
 * 基本vo類型，所有自定義的vo類是這個基本vo類的直接子類，或者間接子類
 * @author anmin
 * Create 2013-3-24
 */
public class BaseVO {
	/**
	 * id,记录的唯一标识
	 */
	public String id;
	/**
	 * 记录激活标识，0代表记录无效，1代表记录处于激活状态
	 */
	public String activityFlag;
	/**
	 * 记录创建者
	 */
	public String creator;
	/**
	 * 记录创建日期
	 */
	public String creationDate;
	/**
	 * 记录修改者
	 */
	public String modifior;
	/**
	 * 记录修改时间
	 */
	public String modifyDate; 
	/**
	 * 系统当前语言标识，"zh_CN"代表中文语言，其他的代表英文环境
	 */
	public String language;
	
	public BaseVO(){
		this.initLanguge();
	}
	
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getActivityFlag() {
		return activityFlag;
	}
	
	public void setActivityFlag(String activityFlag) {
		this.activityFlag = activityFlag;
	}
	
	public String getCreator() {
		return creator;
	}
	
	public void setCreator(String creator) {
		this.creator = creator;
	}
	
	public String getCreationDate() {
		return creationDate;
	}
	
	public void setCreationDate(String creationDate) {
		this.creationDate = creationDate;
	}
	
	public String getModifior() {
		return modifior;
	}
	
	public void setModifior(String modifior) {
		this.modifior = modifior;
	}
	
	public String getModifyDate() {
		return modifyDate;
	}
	
	public void setModifyDate(String modifyDate) {
		this.modifyDate = modifyDate;
	}
	
	public String getLanguage() {
		return language;
	}
	
	public void setLanguage(String language) {
		this.language = language;
	}
	
	/**
	 * 初始化語言信息，
	 * @author anmin
	 * Create 2013-3-24
	 */
	private void initLanguge(){
	   HttpServletRequest request = ServletActionContext.getRequest();
	   HttpSession session = request.getSession();
	   Object lan = session.getAttribute("ceswich");
	   if(lan == null || "".equals(lan)){
		   Locale locale = Locale.getDefault();
		   String countryCodeName = locale.getCountry();
		   if("CN".equals(countryCodeName)){
			   this.language = "zh_CN";
		   }else{
			   this.language = "en_US";
		   }
	   }else{
		   this.language = lan + "";
	   }
	}
	
}
